package com.example.demo.excel.model;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import com.diboot.file.excel.BaseExcelModel;
import com.diboot.file.excel.annotation.ExcelBindField;
import com.example.demo.entity.Goods;
import com.example.demo.entity.ProcurementPlanItem;
import com.example.demo.entity.Unit;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;

import java.math.BigDecimal;


@Getter
@Setter
@ExcelIgnoreUnannotated
@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 1)
public class ProcurementOrderItemImportModel extends BaseExcelModel {
  @ExcelProperty(value = "采购单号")
  private Long procurementOrderId;

  @ExcelIgnore
  private Long procurementPlanItemId;

  @ExcelBindField(entity = ProcurementPlanItem.class, field = "name", setIdField = "procurementPlanItemId")
  @Length(max = 100, message = "名称长度应小于100")
  @ExcelProperty(value = "名称")
  private String name;


  @ExcelProperty(value = "描述")
  @Length(max = 100, message = "描述长度应小于100")
  private String note;

  @ExcelProperty(value = "数量")
  private BigDecimal quantity;


  @ExcelBindField(entity = Unit.class, field = "name", setIdField = "unitId")
  @ExcelProperty(value = "单位名称")
  private String unitName;

  @ExcelIgnore
  private Long unitId;


}
